<template>
	<input-table style="width:100%"
	             :readOnly="$props.readOnly"
	             v-model="table" @add="v=>{}">
        <template #header>
		<div   v-if="title" class="title">
			{{title}}
		</div></template>
		<el-table-column align="center" label="数据类型是对象或数组时，子级的类型定义">
			<template v-slot="scope">
				<el-input v-model="scope.row.items"></el-input>
			</template>
		</el-table-column>
		<el-table-column align="center" label="属性名">
			<template v-slot="scope">
				<el-input v-model="scope.row.key"></el-input>
			</template>
		</el-table-column>
		<el-table-column align="center" label="type" >
			<template v-slot="scope">
				<selector  v-model="scope.row.type" enum="ApiParameterTypeEnum" />
			</template>
		</el-table-column>
		<el-table-column align="center" label="isList">
			<template v-slot="scope">
				<selector v-model="scope.row.isList" :data="{true:'是',false:'否','':'全部'}" />
			</template>
		</el-table-column>
		<el-table-column align="center" label="可选数据,当 type 是 Radio,Check, 或者 arrayItemType 是Radio,Check 时">
			<template v-slot="scope">
				<el-input v-model="scope.row.enumData"></el-input>
			</template>
		</el-table-column>
		<el-table-column align="center" label="stringTye" >
			<template v-slot="scope">
				<selector  v-model="scope.row.stringTye" enum="ApiParameterStringTypeEnum" />
			</template>
		</el-table-column>
		<el-table-column align="center" label="type=object时,引入的类型,apiModel">
			<template v-slot="scope">
				<el-input v-model="scope.row.objectApiModelType"></el-input>
			</template>
		</el-table-column>
		<el-table-column align="center" label="默认值">
			<template v-slot="scope">
				<el-input v-model="scope.row.defaultValue"></el-input>
			</template>
		</el-table-column>
		<el-table-column align="center" label="must">
			<template v-slot="scope">
				<selector v-model="scope.row.must" :data="{true:'是',false:'否','':'全部'}" />
			</template>
		</el-table-column>
		<el-table-column align="center" label="备注">
			<template v-slot="scope">
				<el-input v-model="scope.row.remark"></el-input>
			</template>
		</el-table-column>
	</input-table>

</template>
<style scoped lang="scss">
.title{
	margin-top:10px;
	&:after{
		content: "：";
		display: inline-block;
	}
}
</style>
<script setup>
/**
 * Created by CodeGenerator at 2023-10-16 23:11:38
 */



defineOptions({
    name: "ref-table-api-body-parameter-define",
    inheritAttrs: true,
});

//定义 vue2的this,当前组件
const $self = getCurrentInstance();

//定义 $attrs
const $attrs = useAttrs();



//定义data
const $data = reactive({
    ApiParameterTypeEnum: jv.enum.ApiParameterTypeEnum.getData(),
    ApiParameterStringTypeEnum: jv.enum.ApiParameterStringTypeEnum.getData(),
    value2: null
});


const $props = defineProps({
    title : { type: String },
    readOnly : { type: Boolean }
});


const $model = defineModel({ type: Array });



const list = ref();

//定义事件
const $emit = defineEmits(["update:modelValue","loaded"]);

const table = $computed({ get() {
        return $model;
    },set(folders){
        var v = Object.assign(v.getJsType() == "array" ? [] : {},folders);
        $emit("update:modelValue", v);
    } });

const procData = function(res, op) {
    let json = res.data.data;
    json.forEach(it => {
//如果是组合实体，设置 it.id=...
        jv.enum.ApiParameterTypeEnum.fillRes(it, "type");
        jv.enum.ApiParameterStringTypeEnum.fillRes(it, "stringTye");
    });
};





</script>
